/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Random;

/**
 * <p>Project: jse2302 - Ex2
 * <p>Powered by webrx On 2023-06-12 17:19:46
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex5 {
    public static void main(String[] args) {
        Random rand = new Random();
        //打印输出九九乘法
        for (int a = 1; a <= 9; a++) {
            for (int b = 1; b <= a; b++) {
                int fg = rand.nextInt(31, 37);
                //fg = 31;
                int bg = rand.nextInt(41, 47);
                //bg = 43;
                System.out.printf("\033[%d;%dm%d×%d=%2d\033[0m \t", fg, bg, b, a, a * b);
            }
            System.out.println();
        }
        System.out.println();
        for (int a = 9; a >= 1; a--) {
            for (int b = 1; b <= a; b++) {
                int fg = rand.nextInt(31, 37);
                //fg = 31;
                int bg = rand.nextInt(41, 47);
                //bg = 43;
                System.out.printf("\033[%d;%dm%d×%d=%2d\033[0m \t", fg, bg, b, a, a * b);
            }
            System.out.println();
        }
    }
}
